<{include file="public_html/header.html"}>
<{include file="public_html/left_menu.html"}>
	<blockquote class="layui-elem-quote"><{$action}></blockquote>

	<fieldset class="layui-elem-field">
		<legend>按条件搜索</legend>
		<div class="layui-field-box">
				<form class="layui-form layui-form-pane1" method="post" action="<{$current_url}>" id="order_form">
					
					<div class="layui-form-item">
						<div class="layui-input-inline">
							<select name="school_id" class="abc" lay-search="" lay-verify="required" id="cate_id" placeholder="请选择" lay-filter="cate_id">
								<option value="">网校</option>
								<{foreach from=$schools item=item}>
									<option value="<{$item.id}>" <{if $conditions['school_id'] eq $item.id}>selected="selected"<{/if}>><{$item.school_name}></option>
								<{/foreach}>
							</select>
						</div>
						<div class="layui-input-inline">
							<select name="order_status" class="abc" lay-search="" lay-verify="required" id="cate_id" placeholder="请选择" lay-filter="cate_id">
								<option value="9">订单状态</option>
								<option value="0" <{if $conditions['order_status'] eq 0}>selected="selected"<{/if}>>未支付</option>
								<option value="1" <{if $conditions['order_status'] eq 1}>selected="selected"<{/if}>>已支付</option>
								<option value="2" <{if $conditions['order_status'] eq 2}>selected="selected"<{/if}>>已发货</option>
							</select>
						</div>

						<div class="layui-input-inline">
							<input class="layui-input" name="start_time" value="<{if $conditions['start_time']|default:0 != 0}><{$conditions['start_time']}><{/if}>" placeholder="开始日" id="LAY_demorange_s">
						</div>
						<div class="layui-form-mid">-</div>

						<div class="layui-input-inline">
							<input class="layui-input" name="end_time" value="<{if $conditions['end_time']|default:0 != 0}><{$conditions['end_time']}><{/if}>"  placeholder="截止日" id="LAY_demorange_e">
						</div>

						<div class="layui-inline">
							<button type="submit" class="layui-btn">搜索</button>
							<button type="button" class="layui-btn" id="total">统计金额</button>
						</div>
					</div>
				</form>
		</div>
	</fieldset>
			
	
		<!-- <div class="mt">
			<span class="l fs16">状态：</span>
			
		</div> -->
		<table class="layui-table" lay-even lay-skin="row">
			<thead>
				<tr>
					<th>订单号</th>
					<th>学校</th>
					<th>学员</th>
					<th>订单类型</th>
					<th>订单价格</th>
					<th>下单时间</th>
					<th>状态</th>
					
				</tr>
			</thead>   
			<tbody>
			<{foreach from=$orders item=item}>
				<tr>
					<td class="not_lb tal"><{$item['order_num']}></td>
					<td class="not_lb tal">
						<{$item['school_name']}>
					</td>
					<td>
					<{$item['buyer_user_name']}>
					
					</td>
					<td>
						<{if $item['order_type']==1}>
						视频课
						<{elseif $item['order_type']==2}>
						直播课
						<{elseif $item['order_type']==3}>
						面授课
						<{elseif $item['order_type']==4}>
						题库
						<{elseif $item['order_type']==5}>
						实训
						<{/if}>
						
					</td>
					<td class="not_lb tal"><span class="c-ff6d5e">¥<{$item.total_order_amount}>元</span></td>
					<td class="not_lb tal">
						<{$item[ 'order_time']|date_format: '%Y-%m-%d <br> %H:%M:%S'}></td>
					<td class="not_lb tal">
					
						<{if $item['order_status'] == -1}>
						已取消
						<{elseif $item['order_status'] == 0}>
						待支付
						<{elseif $item['order_status'] == 1}>

						已支付
						<{elseif $item['order_status'] == 2}>
						已发货
						<{/if}>
					</td>
					
				</tr>
			<{/foreach}>
			<{if $orders|count eq 0}>
				<tr>
					<td class="center" style=" height:120px; text-align:center;line-height:120px;" colspan="8">
						赞无数据！
					</td>
				</tr>
			<{/if}>
			<tr>
				<td class="center" colspan="12">
					<!-- <input type="checkbox" lay-filter="checkbox_all" title="全选">
					<button id="delete" class="layui-btn layui-btn-primary layui-btn-small" style="margin-top:4px;"><i class="layui-icon"></i> 批量删除</button> -->
				</td>
			</tr>
			</tbody>
		</table>
	
	<div class="layui-box layui-laypage layui-laypage-default">
			<{$pagination}>
		</div>
<{include file="public_html/footer.html"}>
<script>
	layui.use('laydate', function(){
		var laydate = layui.laydate;
		var start = {
			min: '2016-11-31 23:59:59'
			,max: laydate.now(+1)
			,istoday: false
			,choose: function(datas){
				end.min = datas; //开始日选好后，重置结束日的最小日期
				end.start = datas //将结束日的初始值设定为开始日
			}
		};

		var end = {
			min: '2016-11-31 23:59:59'
			,max: laydate.now(+1)
			,istoday: false
			,choose: function(datas){
				start.max = datas; //结束日选好后，重置开始日的最大日期
			}
		};

		document.getElementById('LAY_demorange_s').onclick = function(){
			start.elem = this;
			laydate(start);
		}
		document.getElementById('LAY_demorange_e').onclick = function(){
			end.elem = this
			laydate(end);
		}
	});
	$("#total").click(function(){
		$.ajax({
			type: "POST",
			url: "/order_offline_course/get_amount",
			dataType:"json",
			async:false,
			data:$("#order_form").serializeArray(),
			contentType:'application/x-www-form-urlencoded',
			success: function(result){
				layer.open({
			  		title: '金额统计',
			  		content: "当前条件下订单总金额为："+result+"元"
				});
			}
		});
	})
</script>
